<template>
  <div class="app-container-flex">
    <NewFullScreen
      v-model="showDialog"
      :title="title"
      :btnList="fullInfo.btnList"
    >
      <div class="insertChangeBtn" v-if="state.showBtn">
        <el-button
          @click="checkChangBtn(1)"
          :class="state.isChangBtn === 1 ? '' : 'notActiveBtn'"
          >产品条码</el-button
        >
        <el-button
          @click="checkChangBtn(3)"
          :class="state.isChangBtn === 3 ? '' : 'notActiveBtn'"
          >产品码</el-button
        >
        <el-button
          @click="checkChangBtn(2)"
          :class="state.isChangBtn === 2 ? '' : 'notActiveBtn'"
          >资产条码</el-button
        >
        <el-button
          @click="checkChangBtn(4)"
          :class="state.isChangBtn === 4 ? '' : 'notActiveBtn'"
          >财务资产条码</el-button
        >
        <el-button
          @click="checkChangBtn(5)"
          :class="state.isChangBtn === 5 ? '' : 'notActiveBtn'"
          >货位编号</el-button
        >
      </div>
      <div class="model-panel">
        <div class="model-panel-title">
          <p>{{ $t('basic_information') }}</p>
        </div>
        <div class="model-panel-body">
          <!-- form -->
          <page-form
            class="paddingBox order-model-formBox flex_wrap_start_start"
            v-model:ref-obj="formInfo.ref"
            :data="formInfo.data"
            :field-list="getFromInfo()"
            :rules="getRules()"
            :list-type-info="listTypeInfo"
            :label-width="formInfo.labelWidth"
          >
            <template #form-name>
              <el-input
                type="input"
                v-model="formInfo.data.name"
                maxlength="100"
                @input="(e) => (formInfo.data.name = validSe(e))"
              ></el-input>
            </template>
            <template #form-remark>
              <el-input
                type="input"
                maxlength="200"
                v-model="formInfo.data.remark"
                @input="(e) => (formInfo.data.remark = validSe(e))"
              ></el-input>
            </template>
          </page-form>
        </div>
      </div>
      <!--      <div class="model-panel" v-if="isChangBtn !== 3 ">-->
      <div class="model-panel" v-if="state.isChangBtn === 1">
        <div class="model-panel-title">
          <p>{{ state.isChangBtn === 1 ? '关联产品' : $t('detailInfo') }}</p>
        </div>
        <div class="model-panel-body">
          <!-- 条件栏 -->
          <NewPageFilter
            v-model:query="filterInfo1.query"
            :filter-btn="
              state.isChangBtn !== 2 ? filterInfo1.list : filterInfo1.deviceList
            "
          >
            <template #filter-removeProduct>
              <el-button
                @click="deleteRow"
                :disabled="!tableInfo.productSelections.length"
                >删除</el-button
              >
            </template>
            <template #filter-removeDevice>
              <el-button
                @click="removeDevice"
                :disabled="!tableInfo.deviceSelections.length"
                >删除</el-button
              >
            </template>
          </NewPageFilter>
          <div class="flex_full_item">
            <!-- 表格 -->
            <page-table
              :refresh="tableInfo.refresh"
              :init-curpage="tableInfo.initCurpage"
              v-model:data="tableInfo.data"
              :tabIndex="false"
              :pager="false"
              :mergeData="tableInfo.mergeData"
              :mergeFiled="tableInfo.mergeFiled"
              :api="tableInfo.api"
              :query="filterInfo.query"
              :field-list="
                state.isChangBtn !== 2
                  ? tableInfo.fieldList
                  : tableInfo.deviceFieldList
              "
              :handle="tableInfo.handle"
              @handleEvent="handleEvent"
            ></page-table>
          </div>
        </div>
      </div>
    </NewFullScreen>

    <select-product
      v-if="productInfo.visible"
      :query="productInfo.query"
      @callback="_selectProduct"
      v-model:showDialog="productInfo.visible"
      :api="getProductIdUseInQrCode"
    />
    <select-all-equipment
      :query="deviceInfo.query"
      v-if="deviceInfo.visible"
      @callback="selectDevice"
      v-model:showDialog="deviceInfo.visible"
      :api="getDeviceIdUseInQrCode"
    />
  </div>
</template>

<script setup name="codeRuleInsert">
import {
  insertQrCodeRule,
  findQrCodeRule,
  updateQrCodeRule,
  getProductIdUseInQrCode,
  getDeviceIdUseInQrCode,
} from '@/api/base.js'
import { ElMessageBox } from 'element-plus'

import PageForm from '@/components/PageForm/index'
import PageTable from '@/components/PageTable/index'

import selectProduct from '@/components/SelectProduct/index'
import SelectAllEquipment from '@/components/SelectAllEquipment/index'

const emit = defineEmits()
const { proxy } = getCurrentInstance()
const props = defineProps({
  visible: {
    type: Boolean,
    default: function () {
      return false
    },
  },
  title: {
    type: String,
    default: function () {
      return ''
    },
  },
  tableRow: {
    type: Object,
    default: function () {
      return {}
    },
  },
  type: {
    type: String,
    default: function () {
      return ''
    },
  },
  isActive: {},
})
const showDialog = computed({
  get() {
    if (props.visible) {
      getMethods()
    }
    return props.visible
  },
  set(newValue) {
    emit('update:visible', newValue) // 更新父组件visible
  },
})

const state = reactive({
  formDisabled: false,
  old: '',
  isChangBtn: 1, //1:产品，2:设备,3:产品码
  showBtn: true,
  copyData: '',
})
const fullInfo = reactive({
  btnList: [
    { label: '规则设计', event: designRule, show: true },
    { label: '保存', event: save, show: true },
  ],
})

let productInfo = reactive({
  visible: false,
  query: {
    //deptProductAuth: 'id',
    deptId: '',
  },
})
const deviceInfo = reactive({
  visible: false,
  query: {
    deptProductAuth: 'id',
    deptId: '',
  },
})
// 过滤相关配置
const filterInfo = reactive({
  query: {
    sort: 'create_time desc',
    searchType: 'orderSequence',
  },
  // list: [
  //   { type: "button", label: "设计条码", event: create },
  //   { type: "button", label: "保存", event: create },
  //   { type: "button", label: "返回", event: search },
  // ],
})
// 过滤相关配置
const filterInfo1 = reactive({
  query: {
    sort: 'create_time desc',
    searchType: 'orderSequence',
  },
  list: [
    { type: 'button', label: '添加产品', event: addProduct },
    { type: 'slot', value: 'removeProduct' },
  ],
  deviceList: [
    { type: 'button', label: '添加设备', event: addDevice },
    { type: 'slot', label: 'removeDevice' },
  ],
})
// 表单信息
const listTypeInfo = reactive({
  codeFix: [
    { key: '/', value: '//' },
    { key: '()', value: '()' },
    { key: '[]', value: '[]' },
    { key: '{}', value: '{}' },
    { key: '<>', value: '<>' },
  ],
})
const formInfo = reactive({
  ref: null,
  data: {
    //字段顺序不能变，至少前4个不能变
    name: '',
    width: '',
    height: '',
    qrCodeSize: undefined,
    codeSeparator: '',
    productionDateSeparator: '',
    factoryCodeSeparator: '',
    remark: '',
    contractuseDateSeparator: '',
    maintainDateSeparator: '',
    standardSeparator: '',
    separator: '',
    deptId: '',
  },
  product: [
    { label: '名称', value: 'name', type: 'slot' },
    {
      label: '宽度(mm)',
      value: 'width',
      type: 'number',
      min: 1,
      max: 500,
    },
    {
      label: '高度(mm)',
      value: 'height',
      type: 'number',
      min: 1,
      max: 500,
    },
    {
      label: '二维码尺寸',
      value: 'qrCodeSize',
      max: 500,
      type: 'number',
      show: true,
    },
    {
      type: 'select-model',
      label: '分隔符',
      value: 'separator',
      checkDefault: false,
      event: search,
      clearable: true,
      code: 'qr_code_separator',
      disabled: false,
    },
    {
      label: '备注',
      value: 'remark',
      type: 'textarea',
    },
  ],
  productCode: [
    { label: '名称', value: 'name', type: 'slot' },
    {
      label: '宽度(mm)',
      value: 'width',
      type: 'number',
      min: 1,
      max: 500,
    },
    {
      label: '高度(mm)',
      value: 'height',
      type: 'number',
      min: 1,
      max: 500,
    },
    {
      label: '备注',
      value: 'remark',
      type: 'textarea',
    },
  ],
  device: [
    { label: '名称', value: 'name', type: 'slot' },
    {
      label: '宽度(mm)',
      value: 'width',
      type: 'number',
      min: 1,
      max: 500,
    },
    {
      label: '高度(mm)',
      value: 'height',
      type: 'number',
      min: 1,
      max: 500,
    },
    // {
    //   label: "二维码尺寸",
    //   value: "qrCodeSize",
    //   type: "number",
    //   show: true,
    // },
    // { label: "设备名称", value: "nameSeparator", type: "select", list: 'codeFix'},
    // {
    //   label: "资产编码",
    //   value: "codeSeparator",
    //   type: "select",
    //   list: "codeFix",
    // },
    // {
    //   label: "厂家编码",
    //   value: "factoryCodeSeparator",
    //   type: "select",
    //   list: "codeFix",
    // },
    // {
    //   label: "规格/型号",
    //   value: "standardSeparator",
    //   type: "select",
    //   list: "codeFix",
    // },
    // {
    //   label: "生产日期",
    //   value: "productionDateSeparator",
    //   type: "select",
    //   clearable: true,
    //   list: "codeFix",
    // },
    // {
    //   label: "保修到期",
    //   value: "maintainDateSeparator",
    //   type: "select",
    //   clearable: true,
    //   list: "codeFix",
    // },
    // {
    //   label: "启用日期",
    //   value: "contractuseDateSeparator",
    //   type: "select",
    //   clearable: true,
    //   list: "codeFix",
    // },
    {
      label: '备注',
      value: 'remark',
      type: 'textarea',
    },
  ],
  financeAsset: [
    { label: '名称', value: 'name', type: 'slot' },
    {
      label: '宽度(mm)',
      value: 'width',
      type: 'number',
      min: 1,
      max: 500,
    },
    {
      label: '高度(mm)',
      value: 'height',
      type: 'number',
      min: 1,
      max: 500,
    },
    {
      label: '备注',
      value: 'remark',
      type: 'textarea',
    },
  ],
  cargoSpace: [
    { label: '名称', value: 'name', type: 'slot' },
    {
      label: '宽度(mm)',
      value: 'width',
      type: 'number',
      min: 1,
      max: 500,
    },
    {
      label: '高度(mm)',
      value: 'height',
      type: 'number',
      min: 1,
      max: 500,
    },
    {
      label: '备注',
      value: 'remark',
      type: 'textarea',
    },
  ],
  labelWidth: '135px',
})

const rules = reactive({
  product: {
    name: [
      { required: true, message: '请填写名称', trigger: 'blur' },
      {
        max: 50,
        message: '字符长度1-50',
        trigger: 'change',
      },
    ],
    height: [
      {
        required: true,
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写高度',
        trigger: 'blur',
      },
    ],
    width: [
      {
        required: true,
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写宽度',
        trigger: 'blur',
      },
    ],
    qrCodeSize: [
      {
        required: true,
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写二维码尺寸',
        trigger: 'blur',
      },
    ],
    separator: [{ required: true, message: '请选择分隔符', trigger: 'change' }],
  },
  productCode: {
    name: [
      { required: true, message: '请填写名称', trigger: 'blur' },
      {
        max: 50,
        message: '字符长度1-50',
        trigger: 'change',
      },
    ],
    height: [
      {
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写高度',
        trigger: 'blur',
      },
    ],
    width: [
      {
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写宽度',
        trigger: 'blur',
      },
    ],
  },
  device: {
    name: [{ required: true, message: '请填写名称', target: 'blur' }],
    height: [
      {
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写高度',
        target: 'blur',
      },
    ],
    width: [
      {
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写宽度',
        target: 'blur',
      },
    ],
    qrCodeSize: [
      {
        required: true,
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写二维码尺寸',
        target: 'blur',
      },
    ],
    codeSeparator: [
      { required: true, message: '请选择资产编码', target: 'change' },
    ],
    // nameSeparator: [{ required: true, message: "请选择设备名称", target: "change" }],
    factoryCodeSeparator: [
      { required: true, message: '请选择生产厂家', target: 'change' },
    ],
    standardSeparator: [
      { required: true, message: '请选择规格/型号', target: 'change' },
    ],
  },
  financeAsset: {
    name: [{ required: true, message: '请填写名称', target: 'blur' }],
    height: [
      {
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写高度',
        target: 'blur',
      },
    ],
    width: [
      {
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写宽度',
        target: 'blur',
      },
    ],
    qrCodeSize: [
      {
        required: true,
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写二维码尺寸',
        target: 'blur',
      },
    ],
  },
  cargoSpace: {
    name: [{ required: true, message: '请填写名称', target: 'blur' }],
    height: [
      {
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写高度',
        target: 'blur',
      },
    ],
    width: [
      {
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写宽度',
        target: 'blur',
      },
    ],
    qrCodeSize: [
      {
        required: true,
        validator: proxy.$validate.positive,
        type: 'number',
        message: '请填写二维码尺寸',
        target: 'blur',
      },
    ],
  },
})
// 表格相关
const tableInfo = reactive({
  refresh: 1,
  initCurpage: 1,
  data: [],
  productSelections: [],
  deviceSelections: [],
  mergeFiled: ['licenseNumber', 'commonName', 'type', 'standard'],
  mergeData: {},
  fieldList: [
    { label: '产品名称', value: 'commonName' },
    { label: '产品编码', value: 'productCode' },
    { label: '生产厂家', value: 'brandName' },
    { label: '规格', value: 'standard' },
    { label: '单位', value: 'unitName' },
  ],
  deviceFieldList: [
    { label: '设备名称', value: 'name' },
    { label: '编号', value: 'code' },
    { label: '设备分类', value: 'categoryValue' },
    { label: '生产厂家', value: 'factoryValue' },
    { label: '规格/型号', value: 'standard' },
    { label: '单位', value: 'unitValue' },
  ],
  handle: {
    fixed: 'right',
    label: '操作',
    width: '100',
    btList: [
      {
        label: '删除',
        event: deleteRow,
        show: true,
        popconfirmText: '删除后将改变数据,是否继续？',
      },
    ],
  },
})

watch(
  () => state.isChangBtn,
  (val, old) => {
    state.old = old
  },
  {
    deep: true, // 深度监听
  }
)

state.isChangBtn = props.isActive
state.copyData = Object.assign({}, formInfo.data)

// insertQrCodeRule;
// findQrCodeRule;
// updateQrCodeRule;
function getFromInfo() {
  let _formInfo = formInfo
  console.log(state.isChangBtn)

  if (state.isChangBtn === 1) {
    return _formInfo.product
  } else if (state.isChangBtn === 2) {
    return _formInfo.device
  } else if (state.isChangBtn === 3) {
    return _formInfo.productCode
  } else if (state.isChangBtn === 4) {
    return _formInfo.financeAsset
  } else if (state.isChangBtn === 5) {
    return _formInfo.cargoSpace
  }
}
function getRules() {
  let _rules = rules
  if (state.isChangBtn === 1) {
    return _rules.product
  } else if (state.isChangBtn === 2) {
    return _rules.device
  } else if (state.isChangBtn === 3) {
    return _rules.productCode
  } else if (state.isChangBtn === 4) {
    return _rules.financeAsset
  } else if (state.isChangBtn === 5) {
    return _rules.cargoSpace
  }
}
function getMethods() {
  if (props.type === 'edit') {
    proxy.$nextTick(function () {
      state.formDisabled = true

      getDetail()
      state.showBtn = false
      formInfo.product.forEach((item) => {
        if (item.value == 'separator') {
          item.disabled = true
        }
      })
    })
  } else if (props.type === 'detail') {
    getDetail()
    state.formDisabled = true
    state.showBtn = true
  }
}
function checkChangBtn(str) {
  let data = formInfo.data
  let values = Object.values(data)
  let flag = true
  values.filter((item, index) => {
    if (index !== 1 && index !== 2 && index !== 3) {
      if ((item !== '' || tableInfo.data.length > 0) && state.old === str) {
        if (flag) {
          flag = false
          proxy
            .$confirm('确定要切换吗，切换将清空输入的数据', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning',
            })
            .then(() => {
              flag = true
              state.isChangBtn = str
              formInfo.data = Object.assign({}, state.copyData)
              tableInfo.data = []
              proxy.$nextTick(() => {
                formInfo.ref.clearValidate()
              })
            })
            .catch(() => {
              flag = true
            })
        }
      } else {
        state.isChangBtn = str
        proxy.$nextTick(() => {
          formInfo.ref.clearValidate()
        })
      }
    }
  })
}
function getDetail() {
  findQrCodeRule(props.tableRow.id).then((resp) => {
    if (resp && resp.success) {
      if (state.isChangBtn === 1) {
        tableInfo.data = resp.data.relationProducts
      } else {
        if (resp.data.deviceDetails && resp.data.deviceDetails.length > 0) {
          let tData = []
          resp.data.deviceDetails.forEach((item) => {
            let tmp = {}
            tmp.name = item.deviceName
            tmp.code = item.deviceCode
            tmp.categoryValue = item.categoryName
            tmp.factoryValue = item.factoryName
            tmp.standard = item.standard
            tmp.unitValue = item.unitName
            tmp.deviceId = item.deviceId

            tData.push(tmp)
          })
          tableInfo.data = tData
        }
        // tableInfo.data = resp.data.deviceDetails;
      }

      resp.datawidth = String(resp.data.width)
      formInfo.data = {
        ...resp.data,
      }
      proxy.$nextTick(() => {
        formInfo.ref.clearValidate()
      })
    }
  })
}
function handleEvent(event, data) {
  const _tableInfo = tableInfo
  switch (event) {
    case 'tableCheck':
      if (state.isChangBtn === 1) {
        _tableInfo.productSelections = [...data]
      } else if (state.isChangBtn === 2) {
        _tableInfo.deviceSelections = [...data]
      }
      break
  }
}
function save() {
  formInfo.ref.validate((valid) => {
    if (valid) {
      if (!formInfo.data.qrCodeRule) {
        proxy.$message({
          message: '你还未添加打印规则',
          type: 'warning',
          duration: 3500,
          showClose: true,
        })
        return
      }
      if (state.isChangBtn === 1) {
        formInfo.data.relationProducts = [...tableInfo.data]
        if (props.tableRow && props.tableRow.id) {
          delete formInfo.data.details
        }
      } else if (state.isChangBtn === 2) {
        formInfo.data.deviceDetails = [...tableInfo.data]
      }

      if (props.type === 'add') {
        formInfo.data.qrType = state.isChangBtn
        insertQrCodeRule(
          proxy.$fn.delEmptyAttribute(formInfo.data, ['remark'])
        ).then((resp) => {
          if (resp && resp.success) {
            showDialog.value = false
            emit('returnModify', false)
          }
        })
      } else {
        updateQrCodeRule(formInfo.data).then((resp) => {
          if (resp && resp.success) {
            showDialog.value = false
            emit('returnModify', false)
          }
        })
      }
    }
  })
}
function create() {}
//添加产品按钮
function addProduct() {
  const _tableInfo = tableInfo
  console.log(_tableInfo)
  const idNotIn = _tableInfo.data.map(function (item) {
    return item.productId
  })
  if (idNotIn.length > 0) {
    productInfo.query = {
      idNotIn: idNotIn.toString(),
    }
  }
  productInfo.visible = true
}
function addDevice() {
  //添加设备
  const _tableInfo = tableInfo
  const idNotIn = _tableInfo.data.map(function (item) {
    return item.deviceId
  })
  if (idNotIn.length > 0) {
    deviceInfo.query = {
      idNotIn: idNotIn.toString(),
    }
  }
  deviceInfo.visible = true
}
function search() {}
//返回按钮
function comeBack() {
  return new Promise((resolve, reject) => {
    ElMessageBox.confirm('你还有操作未保存，确认返回吗?', '提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',
    })
      .then(() => {
        search
      })
      .catch((e) => {
        reject(e)
      })
      .catch((e) => {
        reject(e)
      })
  })
}
//删除产品
function deleteRow(row) {
  if (row && row.productId) {
    tableInfo.data = tableInfo.data.filter((rowItem) => row !== rowItem)
  } else {
    proxy
      .$confirm('删除后将改变数据,是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'info',
      })
      .then(() => {
        tableInfo.data = tableInfo.data.filter((rowItem) =>
          state.isChangBtn === 1
            ? !tableInfo.productSelections.includes(rowItem)
            : !tableInfo.deviceSelections.includes(rowItem)
        )
      })
  }
}
function _selectProduct(rows) {
  if (rows && Object.keys(rows).length) {
    console.log('rows', rows)
    const data = rows.map(function (item) {
      return { ...item, productId: item.id }
    })
    tableInfo.data = tableInfo.data.concat(data)
  }
}
function selectDevice(rows) {
  if (rows) {
    const data = rows.map(function (item) {
      return { ...item, productId: item.id }
    })
    data.forEach((item) => {
      item.deviceId = item.id
    })
    tableInfo.data = tableInfo.data.concat(data)
    console.log('tableInfo.data')
    console.log(tableInfo.data)
  }
}
function designRule() {
  let defaultRule = ''
  if (state.isChangBtn === 1) {
    //产品默认规则
    defaultRule =
      'LODOP.ADD_PRINT_TEXT(5,5,100,15,"#{hospitalName}");\n' +
      'LODOP.ADD_PRINT_BARCODE(20,4,95,95,"QRCode","#{qrCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"QRCodeVersion",7);\n' +
      'LODOP.ADD_PRINT_TEXT(20,100,190,15,"批号:#{batchNumber}");\n' +
      'LODOP.ADD_PRINT_TEXT(35,100,190,15,"单号:#{orderNo}");\n' +
      'LODOP.ADD_PRINT_TEXT(50,100,190,15,"规格:#{standard}");\n' +
      'LODOP.ADD_PRINT_TEXT(65,100,190,15,"数量:#{qty}");\n' +
      'LODOP.ADD_PRINT_TEXT(80,100,190,15,"保存:#{storageCondition}");\n' +
      'LODOP.ADD_PRINT_TEXT(95,100,190,15,"有效至:#{validityDate}");\n' +
      'LODOP.ADD_PRINT_TEXT(110,5,280,15,"产品名称:#{commonName}");\n' +
      'LODOP.ADD_PRINT_TEXT(125,5,280,15,"生产厂家:#{brandName}");\n' +
      'LODOP.ADD_PRINT_TEXT(140,5,280,15,"供应商:#{supplierName}");\n' +
      'LODOP.ADD_PRINT_TEXT(155,5,280,15,"个体码:#{uniqueCode}");\n' +
      'LODOP.ADD_PRINT_TEXT(185,30,260,15,"价格:#{price}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(200,30,260,15,"试剂编号:#{productCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(215,30,260,15,"生产日期:#{productionDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(230,30,260,15,"别名:#{alias}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(245,30,260,15,"预发货日期:#{expectedDeliverTime}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(260,30,260,15,"产品编码:#{productCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(275,30,260,15,"助记符:#{mnemonic}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(290,30,260,15,"产品分类:#{productCategoryId}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(305,30,260,15,"证照:#{licenseName}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(320,30,260,15,"产品类型:#{productTypeValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(335,30,260,15,"条码类型:#{codeTypeValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(350,30,260,15,"财务科目:#{financialAccountValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(365,30,260,15,"单位换算系数:#{unitConvertCoefficient}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(380,30,260,15,"剂型:#{dosageFormValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(395,30,260,15,"包装规格:#{packingSpecification}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(410,30,260,15,"国家医保名称:#{nationHealthInsurance}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(185,320,260,15,"是否必须批号效期:#{needBatchNumberValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(200,320,260,15,"是否序列号管理:#{needSequenceValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(215,320,260,15,"手术跟台:#{withOperateTableValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(230,320,260,15,"产品近效期（天）:#{productNearlyEffective}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(245,320,260,15,"以领定消:#{acquisitionReplaceConsumeValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(260,320,260,15,"原厂主码:#{mainCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(275,320,260,15,"his产品编码:#{hisCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(290,320,260,15,"是否平台编码:#{platformCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(305,320,260,15,"病案类别:#{caseCategoryValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(320,320,260,15,"发票类别:#{invoiceCategoryValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(335,320,260,15,"是否需要证照:#{needLicenseValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(350,320,260,15,"是否防疫物资:#{epidemicPreventionValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(365,320,260,15,"数量操作模式:#{qtyOperateModeValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(380,320,260,15,"临采:#{temporaryPurchValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(395,320,260,15,"国家医保编码:#{nationCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(410,320,260,15,"省医保编码:#{provinceCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(425,320,260,15,"状态:#{productStatusValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(440,320,260,15,"是否寄售:#{isConsignBusinessValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);'
  } else if (state.isChangBtn === 3) {
    defaultRule =
      'LODOP.PRINT_INIT("");' +
      'LODOP.ADD_PRINT_TEXT(2,3,220,15,"#{hospitalName}");' +
      'LODOP.SET_PRINT_STYLEA(0,"FontSize",8);' +
      'LODOP.ADD_PRINT_BARCODE(19,3,185,30,"128B","#{qrCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"FontSize",6);' +
      'LODOP.ADD_PRINT_TEXT(50,1,260,15,"产品名称:#{commonName}");' +
      'LODOP.ADD_PRINT_TEXT(65,1,260,15,"产品编码:#{productCode}");' +
      'LODOP.ADD_PRINT_TEXT(80,1,260,15,"规格:#{standard}");' +
      'LODOP.ADD_PRINT_TEXT(95,1,260,15,"别名:#{alias}");' +
      'LODOP.ADD_PRINT_TEXT(150,30,260,15,"助记符:#{mnemonic}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(165,30,260,15,"产品分类:#{productCategoryId}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(180,30,260,15,"生产厂家:#{brandName}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(195,30,260,15,"证照:#{licenseName}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(210,30,260,15,"产品类型:#{productTypeValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(225,30,260,15,"条码类型:#{codeTypeValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(240,30,260,15,"财务科目:#{financialAccountValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(255,30,260,15,"单位换算系数:#{unitConvertCoefficient}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(270,30,260,15,"剂型:#{dosageFormValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(285,30,260,15,"包装规格:#{packingSpecification}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(300,30,260,15,"状态:#{productStatusValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(315,30,260,15,"是否必须批号效期:#{needBatchNumberValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(330,30,260,15,"是否序列号管理:#{needSequenceValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(345,30,260,15,"手术跟台:#{withOperateTableValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(360,30,260,15,"产品近效期（天）:#{productNearlyEffective}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(150,320,260,15,"以领定消:#{acquisitionReplaceConsumeValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(165,320,260,15,"原厂主码:#{mainCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(180,320,260,15,"his产品编码:#{hisCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(195,320,260,15,"是否平台编码:#{platformCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(210,320,260,15,"病案类别:#{caseCategoryValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(225,320,260,15,"发票类别:#{invoiceCategoryValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(240,320,260,15,"是否需要证照:#{needLicenseValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(255,320,260,15,"是否防疫物资:#{epidemicPreventionValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(270,320,260,15,"数量操作模式:#{qtyOperateModeValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(285,320,260,15,"临采:#{temporaryPurchValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(300,320,260,15,"国家医保编码:#{nationCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(315,320,260,15,"省医保编码:#{provinceCode}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(330,320,260,15,"国家医保名称:#{nationHealthInsurance}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(375,30,260,15,"品牌:#{trademark}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(360,320,260,15,"财务资产类别:#{financeTypeValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(375,320,260,15,"强制收货验收:#{forceAcceptValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(390,30,260,15,"是否入库管理:#{stockManageValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(390,320,260,15,"医疗器械分类目录:#{deviceTypeValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(405,30,260,15,"配件分类:#{accessoriesCategoryValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(405,320,260,15,"专业分类:#{professionalClassificationValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(420,30,260,15,"是否强检:#{mandatoryTestValue}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(420,320,260,15,"存储条件:#{storageCondition}");' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_RECT(0,0,"50.01mm","30mm",0,1);'
  } else if (state.isChangBtn === 2) {
    //资产默认规则
    defaultRule =
      'LODOP.ADD_PRINT_RECT(0,0,227,151,0,1);\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);\n' +
      'LODOP.ADD_PRINT_TEXT(5,5,100,15,"#{orgName}");\n' +
      'LODOP.ADD_PRINT_BARCODE(20,4,95,95,"QRCode","#{qrCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"QRCodeVersion",7);\n' +
      'LODOP.ADD_PRINT_TEXT(20,100,190,15,"资产编号:#{assetCode}");\n' +
      'LODOP.ADD_PRINT_TEXT(35,100,190,15,"资产名称:#{assetName}");\n' +
      'LODOP.ADD_PRINT_TEXT(50,100,190,15,"规格/型号:#{standard}");\n' +
      'LODOP.ADD_PRINT_TEXT(65,100,190,15,"使用部门:#{useDeptName}");\n' +
      'LODOP.ADD_PRINT_TEXT(110,5,280,15,"生产厂家:#{brandName}");\n' +
      'LODOP.ADD_PRINT_TEXT(144,4,280,15,"负责人:#{responsibleUserName}");\n' +
      'LODOP.ADD_PRINT_TEXT(157,5,280,20,"存放地点:#{location}");\n' +
      'LODOP.ADD_PRINT_TEXT(124,4,280,20,"使用人:#{useUserName}");\n' +
      'LODOP.ADD_PRINT_TEXT(192,30,200,20,"状态:#{statusValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(212,30,200,20,"规格:#{standard}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(232,30,200,20,"品牌:#{mark}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(252,30,200,20,"供应商名称:#{supplierName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(272,30,200,20,"产地:#{originPlace}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(292,30,200,20,"医疗器械分类目录:#{deviceTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(312,30,200,20,"使用部门:#{useDeptName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(332,30,200,20,"管理部门:#{manageDeptName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(352,30,200,20,"使用状态:#{useStatusName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(372,30,200,20,"增加方式:#{increaseTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(392,30,200,20,"计量单位:#{unitName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(412,30,200,20,"数量:#{qty}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(432,30,200,20,"金额:#{primitiveOriginalAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(452,30,200,20,"是否为财务资产:#{isFinanceAssetName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(472,30,200,20,"是否维保:#{isMaintenanceName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(492,30,200,20,"是否为计量设备:#{isMeteringName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(512,30,200,20,"SN:#{machineCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(532,30,200,20,"注册证码:#{registerCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(552,30,200,20,"合同号:#{contractCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(572,30,200,20,"档案号:#{fileCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(192,240,200,20,"发票编号:#{invoiceCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(212,240,200,20,"批号:#{batchNumber}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(232,240,200,20,"出厂日期:#{manufactureDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(252,240,200,20,"生产日期:#{productionDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(272,240,200,20,"安装日期:#{installDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(312,240,200,20,"验收人:#{acceptanceUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(332,240,200,20,"验收日期:#{acceptanceDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(352,240,200,20,"采购人:#{purchUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(372,240,200,20,"采购日期:#{purchDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(392,240,200,20,"开始使用日期:#{useDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(412,240,200,20,"领用人:#{applicationUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(432,240,200,20,"领用日期:#{applicationDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(452,240,200,20,"保管人:#{keeperUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(472,240,200,20,"责任人:#{responsibleUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(492,240,200,20,"接收人:#{receiveUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(512,240,200,20,"资产状态:#{assetStatusValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(532,240,200,20,"财务资产类别:#{financeTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(552,240,200,20,"资产类型:#{assetTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(572,240,200,20,"财务部门:#{financeDeptName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(192,446,200,20,"计提标志:#{accrualMarkValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(212,446,200,20,"原值:#{originalAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(232,446,200,20,"折旧月限:#{deprMonthsLimit}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(252,446,200,20,"净值:#{netAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(272,446,200,20,"残值:#{residualAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(292,446,200,20,"残值率:#{residualRate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(312,446,200,20,"减值准备:#{deprPreparation}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(332,446,200,20,"已使用月数:#{monthsUsed}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(352,446,200,20,"累计折旧:#{sumDeprAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(372,446,200,20,"折旧方法:#{deprMethodTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(392,446,200,20,"折旧惯例:#{deprConventionValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(412,446,200,20,"月折旧率:#{monthDeprRate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(432,446,200,20,"月折旧额:#{monthDeprAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(452,446,200,20,"进项税:#{inputTax}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(472,446,200,20,"入账日期:#{postingDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(492,446,200,20,"保修类型:#{warrantyTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(512,446,200,20,"保修状态:#{warrantyStatusValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(532,446,200,20,"维保商:#{maintenanceProviderName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(552,446,200,20,"维保联系人:#{maintenanceContactsName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(572,446,200,20,"维保联系电话:#{maintenancePhone}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(192,656,200,20,"维保开始日期:#{warrantyStartDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(212,656,200,20,"维保结束日期:#{warrantyEndDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(232,656,200,20,"维保合同编号:#{maintenanceContract}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(252,656,200,20,"维保说明:#{maintenanceDescription}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(272,656,200,20,"标准名称:#{measurementName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(292,656,200,20,"专业分类:#{professionalClassificationValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(312,656,200,20,"是否强检:#{isMandatoryInspectionValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(332,656,200,20,"拼音码:#{pinyinCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(352,656,200,20,"测量范围:#{measurementRange}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(372,656,200,20,"准确度:#{accuracy}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(392,656,200,20,"检定周期:#{verificationPeriod}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(412,656,200,20,"检定类型:#{verificationTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(432,656,200,20,"检定单位:#{verificationUnit}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(452,656,200,20,"检定日期:#{verificationDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(472,656,200,20,"失效日期:#{validityDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(492,656,200,20,"最新检定结果:#{verificationResult}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);'
  } else if (state.isChangBtn === 4) {
    //资产默认规则
    defaultRule =
      'LODOP.ADD_PRINT_RECT(0,0,227,151,0,1);\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);\n' +
      'LODOP.ADD_PRINT_TEXT(5,5,100,15,"#{orgName}");\n' +
      'LODOP.ADD_PRINT_BARCODE(20,4,95,95,"QRCode","#{qrCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"QRCodeVersion",7);\n' +
      'LODOP.ADD_PRINT_TEXT(20,100,190,15,"资产编号:#{assetCode}");\n' +
      'LODOP.ADD_PRINT_TEXT(35,100,190,15,"资产名称:#{assetName}");\n' +
      'LODOP.ADD_PRINT_TEXT(50,100,190,15,"规格/型号:#{standard}");\n' +
      'LODOP.ADD_PRINT_TEXT(65,100,190,15,"使用部门:#{useDeptName}");\n' +
      'LODOP.ADD_PRINT_TEXT(110,5,280,15,"生产厂家:#{brandName}");\n' +
      'LODOP.ADD_PRINT_TEXT(144,4,280,15,"负责人:#{responsibleUserName}");\n' +
      'LODOP.ADD_PRINT_TEXT(157,5,280,20,"存放地点:#{location}");\n' +
      'LODOP.ADD_PRINT_TEXT(124,4,280,20,"使用人:#{useUserName}");\n' +
      'LODOP.ADD_PRINT_TEXT(192,30,200,20,"状态:#{statusValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(212,30,200,20,"规格:#{standard}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(232,30,200,20,"品牌:#{mark}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(252,30,200,20,"供应商名称:#{supplierName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(272,30,200,20,"产地:#{originPlace}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(292,30,200,20,"医疗器械分类目录:#{deviceTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(312,30,200,20,"使用部门:#{useDeptName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(332,30,200,20,"管理部门:#{manageDeptName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(352,30,200,20,"使用状态:#{useStatusName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(372,30,200,20,"增加方式:#{increaseTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(392,30,200,20,"计量单位:#{unitName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(412,30,200,20,"数量:#{qty}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(432,30,200,20,"金额:#{primitiveOriginalAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(452,30,200,20,"是否为财务资产:#{isFinanceAssetName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(472,30,200,20,"是否维保:#{isMaintenanceName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(492,30,200,20,"是否为计量设备:#{isMeteringName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(512,30,200,20,"SN:#{machineCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(532,30,200,20,"注册证码:#{registerCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(552,30,200,20,"合同号:#{contractCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(572,30,200,20,"档案号:#{fileCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(192,240,200,20,"发票编号:#{invoiceCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(212,240,200,20,"批号:#{batchNumber}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(232,240,200,20,"出厂日期:#{manufactureDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(252,240,200,20,"生产日期:#{productionDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(272,240,200,20,"安装日期:#{installDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(312,240,200,20,"验收人:#{acceptanceUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(332,240,200,20,"验收日期:#{acceptanceDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(352,240,200,20,"采购人:#{purchUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(372,240,200,20,"采购日期:#{purchDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(392,240,200,20,"开始使用日期:#{useDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(412,240,200,20,"领用人:#{applicationUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(432,240,200,20,"领用日期:#{applicationDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(452,240,200,20,"保管人:#{keeperUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(472,240,200,20,"责任人:#{responsibleUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(492,240,200,20,"接收人:#{receiveUserName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(512,240,200,20,"资产状态:#{assetStatusValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(532,240,200,20,"财务资产类别:#{financeTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(552,240,200,20,"资产类型:#{assetTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(572,240,200,20,"财务部门:#{financeDeptName}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(192,446,200,20,"计提标志:#{accrualMarkValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(212,446,200,20,"原值:#{originalAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(232,446,200,20,"折旧月限:#{deprMonthsLimit}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(252,446,200,20,"净值:#{netAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(272,446,200,20,"残值:#{residualAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(292,446,200,20,"残值率:#{residualRate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(312,446,200,20,"减值准备:#{deprPreparation}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(332,446,200,20,"已使用月数:#{monthsUsed}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(352,446,200,20,"累计折旧:#{sumDeprAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(372,446,200,20,"折旧方法:#{deprMethodTypeValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(392,446,200,20,"折旧惯例:#{deprConventionValue}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(412,446,200,20,"月折旧率:#{monthDeprRate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(432,446,200,20,"月折旧额:#{monthDeprAmount}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(452,446,200,20,"进项税:#{inputTax}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);' +
      'LODOP.ADD_PRINT_TEXT(472,446,200,20,"入账日期:#{postingDate}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);'
  } else if (state.isChangBtn === 5) {
    //货位编号默认规则
    defaultRule =
      'LODOP.PRINT_INIT("");\n' +
      'LODOP.ADD_PRINT_RECT(2,4,494,167,0,1);\n' +
      'LODOP.SET_PRINT_STYLEA(0,"PreviewOnly",2);\n' +
      'LODOP.ADD_PRINT_TEXT(5,5,100,15,"#{orgName}");\n' +
      'LODOP.ADD_PRINT_BARCODE(22,4,95,95,"QRCode","#{qrCode}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"QRCodeVersion",7);\n' +
      'LODOP.ADD_PRINT_TEXT(109,8,190,15,"存放仓库:#{depotName}");\n' +
      'LODOP.ADD_PRINT_TEXT(28,101,288,27,"编号:#{locationNo}");\n' +
      'LODOP.SET_PRINT_STYLEA(0,"FontSize",12);\n' +
      'LODOP.ADD_PRINT_TEXT(126,8,190,15,"货架序号:#{shelfSerialNo}");\n' +
      'LODOP.ADD_PRINT_TEXT(143,8,190,15,"货架编号:#{shelfNumber}");\n' +
      'LODOP.ADD_PRINT_TEXT(69,100,120,15,"层数:#{locationLayer}");\n' +
      'LODOP.ADD_PRINT_TEXT(68,267,120,15,"列数:#{locationLine}");\n' +
      'LODOP.ADD_PRINT_TEXT(109,203,190,15,"长度(cm):#{locationLength}");\n' +
      'LODOP.ADD_PRINT_TEXT(126,202,190,15,"宽度(cm):#{locationWidth}");\n' +
      'LODOP.ADD_PRINT_TEXT(143,202,190,15,"高度(cm):#{locationHeight}")'
  }

  let defaultPrintCmd = formInfo.data.qrCodeRule || defaultRule
  const data = formInfo.data

  proxy.$print
    .designRule(defaultPrintCmd, data.width, data.height)
    .then((resp) => {
      formInfo.data.qrCodeRule = resp
    })
}
</script>

<style scoped>
.left {
  width: 20% !important;
  margin-right: 10px;
  display: inline-block;
}
.right {
  width: 20% !important;
  margin-right: 60px;
  display: inline-block;
}
.el-checkbox {
  /* width: 100%; */
  display: inline-block;
  /* margin-right: 200px; */
}
.title {
  display: inline-block;
}
.lable {
  display: flex;
  margin-bottom: 10px;
}
.el-checkbox {
  margin-right: 10px;
}
.insertChangeBtn {
  padding-bottom: 10px;
}
</style>
